﻿using ConfExpert.Forms.Base;
using DevTeam;
using System;
using System.Data;
using System.Windows.Forms;

namespace ConfExpert.Forms.Depo.Aksesuar
{
    public partial class AksPOFaturaLines : XForm
    {
        string FaturaNo;
        public AksPOFaturaLines(string FaturaNo)
        {
            InitializeComponent();
            this.FaturaNo = FaturaNo;
        }

        private void AksPOFaturaLines_Load(object sender, EventArgs e)
        {
            

            this.Text = FaturaNo.ToString();
            gvAksPOFaturaLines.Init("GetAksPOFaturaLines", FaturaNo);

            gvAksPOFaturaLines.MakeColumnInvisible( "AksPOFaturaLinesId","FaturaNo");
            gvAksPOFaturaLines.AddSummary("Fiyat");
            gvAksPOFaturaLines.SetCaptions("MaliyetTipiId:MaliyetTipi");

            gvAksPOFaturaLines.FormatAsNumber(2, "Fiyat");

            gvAksPOFaturaLines.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom;
            gvAksPOFaturaLines.DataTable().TableNewRow += AksPOFaturaLines_TableNewRow;
            bbiSave.ItemClick += bbiSave_ItemClick; 
        }

        void bbiSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            gvAksPOFaturaLines.EndEditing();
            gvAksPOFaturaLines.Update("AksPOFaturaLinesId,FaturaNo,MaliyetTipiId,Fiyat", "AksPOFaturaLines");
            this.DialogResult = DialogResult.OK;
        }

        void AksPOFaturaLines_TableNewRow(object sender, DataTableNewRowEventArgs e)
        {
            e.Row["FaturaNo"] = FaturaNo;
        }
    }
}